package com.kingstar.crawler.service.impl;

import com.kingstar.crawler.dao.GoodsRepository;
import com.kingstar.crawler.entity.GoodsInfo;
import com.kingstar.crawler.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.transaction.Transactional;
import java.util.List;

/**
 * @author 王光华
 * @Description:
 * @date 2021/9/13 16:16
 */

@Service
@Transactional

public class GoodsServiceImpl implements GoodsService {
    @Resource
    private GoodsRepository goodsRepository;

    @Override
    public void saveGoodsInfo(GoodsInfo goodsInfo) {
        goodsRepository.save(goodsInfo);
    }

//   // @Override
//    //public List<GoodsInfo> f(GoodsInfo goodsInfo) {
//        org.springframework.data.domain.Example example = org.springframework.data.domain.Example.of(goodsInfo);
//        List all = goodsRepository.findAll(example);
//        return null;
//    }

    @Override
    public List<GoodsInfo> findAll(GoodsInfo goodsInfo){
        return goodsRepository.findAll();
    }
}
